<?php

/**
 * Reglement filter form base class.
 *
 * @package    SdCommerce
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseReglementFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'libelle'              => new sfWidgetFormFilterInput(),
      'numero_reglement'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'numero_piece'         => new sfWidgetFormFilterInput(),
      'banque'               => new sfWidgetFormFilterInput(),
      'montant'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'reste'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'date'                 => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'date_etat'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'date_prise_en_charge' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'date_echeance'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'verser'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'valide'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'etat'                 => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'type'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'id_doc_entete'        => new sfWidgetFormFilterInput(),
      'id_mode_reglement'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ModeReglement'), 'add_empty' => true)),
      'id_organisme'         => new sfWidgetFormFilterInput(),
      'id_caisse'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Caisse'), 'add_empty' => true)),
      'id_compte_bancaire'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CompteBancaire'), 'add_empty' => true)),
      'id_retenue_source'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RetenueSource'), 'add_empty' => true)),
      'journal_caisse'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'created_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'libelle'              => new sfValidatorPass(array('required' => false)),
      'numero_reglement'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'numero_piece'         => new sfValidatorPass(array('required' => false)),
      'banque'               => new sfValidatorPass(array('required' => false)),
      'montant'              => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'reste'                => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'date'                 => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_etat'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_prise_en_charge' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'date_echeance'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'verser'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'valide'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'etat'                 => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'type'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_doc_entete'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_mode_reglement'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ModeReglement'), 'column' => 'id')),
      'id_organisme'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'id_caisse'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Caisse'), 'column' => 'id')),
      'id_compte_bancaire'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CompteBancaire'), 'column' => 'id')),
      'id_retenue_source'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('RetenueSource'), 'column' => 'id')),
      'journal_caisse'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'created_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('reglement_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Reglement';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'libelle'              => 'Text',
      'numero_reglement'     => 'Number',
      'numero_piece'         => 'Text',
      'banque'               => 'Text',
      'montant'              => 'Number',
      'reste'                => 'Number',
      'date'                 => 'Date',
      'date_etat'            => 'Date',
      'date_prise_en_charge' => 'Date',
      'date_echeance'        => 'Date',
      'verser'               => 'Boolean',
      'valide'               => 'Boolean',
      'etat'                 => 'Boolean',
      'type'                 => 'Number',
      'id_doc_entete'        => 'Number',
      'id_mode_reglement'    => 'ForeignKey',
      'id_organisme'         => 'Number',
      'id_caisse'            => 'ForeignKey',
      'id_compte_bancaire'   => 'ForeignKey',
      'id_retenue_source'    => 'ForeignKey',
      'journal_caisse'       => 'Boolean',
      'created_at'           => 'Date',
      'updated_at'           => 'Date',
    );
  }
}
